﻿
using SRM.Application.PageResult.Dtos;
using SRM.Application.PageResult.IServices;
using SRM.Core.Models;
using SRM.Core.Models.Base;
using SRM.Core.Repositories;

using System.Threading.Tasks;

namespace SRM.Application.PageResult.PurchaseOrderPage
{
    public class PurchaseOrderDtlServer : IPurchaseOrderDtlServer
    {
        private readonly IRepository<PurchaseOrderDetail> _purchaseOrderDtlRepository;

        public PurchaseOrderDtlServer(IRepository<PurchaseOrderDetail> purchaseOrderDtlRepository)
        {
            _purchaseOrderDtlRepository = purchaseOrderDtlRepository;
        }

        public async Task<PagerModel<PurchaseOrderDetail>> GetPurchaseOrderDtl(PagerModelInput input)
        {
            var query = await _purchaseOrderDtlRepository.GetAllListAsync();
            PagerModel<PurchaseOrderDetail> pagerModel = PagedList<PurchaseOrderDetail>.PageList(input, query);
            return pagerModel;
        }
    }
}
